<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Web
 *
 * @author ananda
 */
class App_Web extends App
{
    public function init() {}

    public function main($options = array())
    {
        $key = isset($options['key']) ? $options['key'] : 'r';

        // 先随便写写
        $this->route($key);
        $this->controller = $this->createController($this->controller);
        $this->action     = $this->createAction($this->controller, $this->action, $this->params);
        $this->action->main();
    }

    public function route($key = 'r')
    {
        // 先随便写写
        $temp = explode('/', Request::get($key, Com::glob('com.default_controller')));

        $this->controller = ucfirst($temp[0]);
        $this->action     = isset($temp[1]) ? ucfirst(strtolower($temp[1])) : null;

        unset($temp[0]);
        unset($temp[1]);
        $this->params = $temp;
    }

}
